﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DevExpress.Xpf.Ribbon;
using YmSoft.WPF.Core;
using YmSoft.WPF.Modbus;
using YmSoft.WPF.WenShiCanShuSheZhi;


namespace YmSoft.WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : DXRibbonWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        RoomRibbonBuilder roomRibbonBuilder = null;
        private void dXRibbonWindow_Loaded(object sender, RoutedEventArgs e)
        {
            crlContentControl.Content = new YmSoft.WPF.Crl.CrlRealtime();
            ribbonControl.SelectedPageChanged += ribbonControl_SelectedPageChanged;

            roomRibbonBuilder = new RoomRibbonBuilder(roomBarManager, roomRibbonPageGroup);
            roomRibbonBuilder.Build();
        }

        ICommand modBusCommand = null;
        public ICommand ModBusCommand
        {
            get
            {
                if (modBusCommand == null)
                {
                    modBusCommand = new RelayCommand(() =>
                    {
                        var win = new WinModbus();
                        win.ShowDialog();
                    });
                }
                return modBusCommand;
            }
        }

        ICommand wenShiCanShuSheZhiCommand = null;
        public ICommand WenShiCanShuSheZhiCommand
        {
            get
            {
                if (wenShiCanShuSheZhiCommand == null)
                {
                    wenShiCanShuSheZhiCommand = new RelayCommand(() =>
                    {
                        var win = new YmSoft.WPF.WenShiCanShuSheZhi.WinMain();
                        win.ShowDialog();
                    });
                }
                return wenShiCanShuSheZhiCommand;
            }
        }


        ICommand wenQiXiangZhanCommand = null;
        public ICommand WenQiXiangZhanCommand
        {
            get
            {
                if (wenQiXiangZhanCommand == null)
                {
                    wenQiXiangZhanCommand = new RelayCommand(() =>
                    {
                        var win = new YmSoft.WPF.QiXiangZhan.WinMain();
                        win.ShowDialog();
                    });
                }
                return wenQiXiangZhanCommand;
            }
        }

        ICommand wenQiXiangZhanOldCommand = null;
        public ICommand WenQiXiangZhanOldCommand
        {
            get
            {
                if (wenQiXiangZhanOldCommand == null)
                {
                    wenQiXiangZhanOldCommand = new RelayCommand(() =>
                    {
                        var win = new YmSoft.WPF.Old.QiXiangZhan.WinMain();
                        win.ShowDialog();
                    });
                }
                return wenQiXiangZhanOldCommand;
            }
        }

        ICommand wenShoujiCommand = null;
        public ICommand WenShoujiCommand
        {
            get
            {
                if (wenShoujiCommand == null)
                {
                    wenShoujiCommand = new RelayCommand(() =>
                    {
                        var win = new YmSoft.WPF.ShouJi.WinMain();
                        win.ShowDialog();
                    });
                }
                return wenShoujiCommand;
            }
        }



        void ribbonControl_SelectedPageChanged(object sender, RibbonPropertyChangedEventArgs e)
        {
            if (((DevExpress.Xpf.Ribbon.RibbonPage)e.NewValue).Name == "ribbonRealtime")
            {
                crlContentControl.Content = new YmSoft.WPF.Crl.CrlRealtime();
            }
            else
            {
                crlContentControl.Content = new YmSoft.WPF.Crl.CrlBackground();
            }
        }
    }
}
